home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util1
/
jukebx21.lha
/
JukeBox_2.1
/
shuffle.jb
< prev
next >
Wrap
Text File
|
1993-11-22
|
2KB
|
92 lines
/* shuffle play replacement */
/* (c) copyright 1992,93 by F.J. Reichert */
options results;
options failat 11;
/* let's find out how much we have */
trks = numtrks();
if trks = 0 then do;
say 'no tracks found, maybe there''s no disc at all...';
exit(5);
end;
current label;
say 'disc "'||result||'" has' trks 'tracks'
say 'press [ESC] to stop'
do forever;
/* start playing so we'll hear something */
play;
if rc ~= 0 then leave;
/* find out where we are */
current track;
newtrack = result;
/* and how long this track will play */
current trktime;
stop = result;
/* that will give us an idea where we are on the whole disc */
current time;
start = result;
/* ... and how long we already played this track */
current reltime;
played = result;
/* so we'll figure out where this track starts. Easy, isn't it? */
subtime start played
start = result;
/* and calculate where to end */
addtime start stop;
stop = result;
/* some frames less, or we might never reach it */
subtime stop "00:00:10";
stop = result;
/* tell it to the user */
current title;
say 'now playing track #'||overlay(newtrack,' ',1,2) 'from' start 'up to' stop '"'||result||'"'
/* ...and wait until we're finished */
wait time stop;
/* ESC will stop us */
current break;
if result ~= 0 then leave;
/* this track finished. we need to find a new one */
oldtrack = newtrack;
/* please, don't give us the track we've already heard! */
do while newtrack = oldtrack;
newtrack = random(1,trks);
end;
/* and tell the drive where to go on */
set track newtrack;
/* give lazy drives a chance to figure out where
they are, two thirds of a second (50/75) will suffice */
wait absolute "00:00:50"
end;
say 'shuffle play ending';
exit(0);
/* Tell us how many tracks there are on this disc */
numtrks:
options results;
toc stem names.;
if rc = 0 then do
return(names.0 - 1);
end;
else do;
return(0);
end;
end;